package cn.glc.daily.life.web.convert;

import cn.glc.daily.life.infrastructure.po.UserRolePo;
import cn.glc.daily.life.model.enums.UserRoleEnums;
import cn.simon.free.tools.utils.DateUtils;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * 用户角色表
 *
 * @author simon
 * @date 2020/9/24 15:29
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Mapper
public interface UserRoleConvert {
    UserRoleConvert INSTANCE = Mappers.getMapper(UserRoleConvert.class);

    /**
     * 注册用户转授权用户对象
     *
     * @param uid
     * @return
     */
    default UserRolePo ordinary(long uid) {
        UserRolePo userRolePo = new UserRolePo();
        userRolePo.setUid(uid);
        userRolePo.setRoleId(UserRoleEnums.ORDINARY.getLevel());
        userRolePo.setCreateTime(DateUtils.now());
        return userRolePo;
    }
}
